package ControlLayer;
import ModelLayer.*;
import java.util.ArrayList;

/**
 * Write a description of class PersonCtr here.
 * 
 * @author (your name) 
 * @version (a version number or a date)
 */
public class PersonCtr
{
    public PersonContainer personContainer;

    /**
     * Constructor for objects of class PersonCtr
     *
     */
    public PersonCtr()
    {
        personContainer = PersonContainer.getInstance();
    }

    public void createPerson(String name, String address, String city, String zip, String phone)
    {
        personContainer.createPerson(name, address, city, zip, phone);
    }

    public void deletePerson(String name)
    {
        personContainer.deletePerson(name);
    }

    public Person findPerson(String name)
    {
        Person a = personContainer.findPerson(name);
        return a;
    }

    public void updateName(String name, String newName)
    {
        findPerson(name).setName(newName);
    }

    public void updateAddress(String name, String newAddress)
    {
        findPerson(name).setAddress(newAddress);
    }

    public void updateCity(String name, String newCity)
    {
        findPerson(name).setCity(newCity);
    }

    public void updateZip(String name, String newZip)
    {
        findPerson(name).setZip(newZip);
    }

    public void updatePhone(String name, String newPhone)
    {
        findPerson(name).setPhone(newPhone);
    }
    
    public ArrayList<Person> getList()
    {
        return personContainer.getList();
    }
}
